<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>[%$softtitle%]</title>
<link href="templates/css/baselist.css" rel="stylesheet" type="text/css" />
<link href="templates/css/all.css" rel="stylesheet" type="text/css" />
<link href="templates/css/clickmenu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/control.js"></script>
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodyauto")){
			$('.manageadd').css({height:h-40});
			$('.manageedit').css({height:h-40});
		}
	}
	var callmain_js_name_empty  = "[%$ST.callmain_js_name_empty%]";
	var callmain_js_code_empty = "[%$ST.callmain_js_code_empty%]";
	var callmain_js_type_err = "[%$ST.callmain_js_type_err%]";
	var callmain_js_add_ok = "[%$ST.callmain_js_add_ok%]";
	var callmain_js_add_no = "[%$ST.callmain_js_add_no%]";
	var iframename = "[%$iframename%]" ? "jerichotabiframe_0" : "[%$iframename%]";
	iframename = iframename=='' ? "jerichotabiframe_0" : iframename;
	$(document).ready(function(){
		var h = '[%$iframeheightwindow%]';
		$('.manageadd').css({height:h-40});
		var options = {

			beforeSubmit: formverify,

			success:saveResponse,
			resetForm: true
		}
		$('#calladd').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})




	function formverify(formData) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['name']==""){
			document.calladd.name.focus();
			alert(callmain_js_name_empty);
			return false;
		}
		if(get['type']==0){
			document.calladd.type.focus();
			alert(callmain_js_type_err);
			return false;
		}
		if(get['code']==""){
			document.calladd.code.focus();
			alert(callmain_js_code_empty);
			return false;
		}
		parent.windowsdig('Loading','iframe:index.php?archive=management&action=load','400px','180px','iframe',false);
	}
	function saveResponse(options){
		parent.closeifram();
		var tab=document.getElementById("calladdtab").value;
		if (options=='true'){
			if (tab=='true'){
				if(parent.frames[iframename].document.getElementById("pageinfo")){
					parent.frames[iframename].refresh('selectform','selectall','check_all');
				}
			}
			alert(callmain_js_add_ok);
		}else{
			alert(callmain_js_add_no);
		}
		if (tab=='true'){
			parent.onaletdoc()
		}
	}
	function appendvariable(str){
		var value=$(":input[name=\"code\"]").val();
		var newvalue=value+str;
		$(":input[name=\"code\"]").val(newvalue);
	}
	function codetext(type){
		var str='<textarea name="code" id="code" style="width:98%;height:80px;" class="smallInput"></textarea>';
		var str2='<input type="text" name="code" size="50" maxlength="100" class="infoInput" />';
		if (type==1){
			$("#codetext").empty();
			$("#codetext").append(str);
		}else{
			$("#codetext").empty();
			$("#codetext").append(str2);
		}
	}
</script>
</head>

<body>
<form name="calladd" id="calladd" method="post" action="index.php?archive=callmain&action=save">
	<input type="hidden" name="inputclass" value="add">
	<input type="hidden" name="tab" id="calladdtab" value="[%$tab%]">
	<div id="mainbodyauto" class="manageadd">
		<div class="maindobycontent">
			<!--查看已选择的类型-->
			<div class="suggestion">
				<span class="sugicon"><span class="strong colorgorning2">[%$ST.position_title%]</span><span class="colorgorningage">[%$ST.callmain_add_mess%]</span></span>
			</div>
			<div class="sugtitle">
				<span class="sugtitleicon"><span class="strong colorgorning2">[%$ST.callmain_add_namecode%]</span></span>
			</div>
			<div class="sugtitle-line"></div>
			<div class="formdiv">
				<table border="0" width="100%">
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">[%$ST.callmain_add_name%]</td>
						<td width="85%" class="trtitle02"><input type="text" name="name" size="25" maxlength="20" class="infoInput" /> <span class="cautiontitle">[%$ST.callmain_add_name_mess%]</span></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">[%$ST.callmain_add_type%]</td>
						<td width="85%" class="trtitle02">
							<select size="1" name="type" id="type" onchange="javascript:selectlinkagelng('styleid','index.php?archive=connected&action=callstyle&type='+this.value);codetext(this.value)">
								<option selected value="0">[%$ST.callmain_add_type_option%]</option>
								[%forlist from=$type key=list%]
								<option value="[%$type[list].key%]">[%$type[list].name%]</option>
								[%/forlist%]
							</select>
							<span class="cautiontitle">[%$ST.callmain_add_type_mess%]</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">[%$ST.callmain_add_style%]</td>
						<td width="85%" class="trtitle02">
							<select size="1" name="style" id="styleid">
								<option selected value="0">[%$ST.callmain_add_style_option%]</option>
								[%forlist from=$style key=list%]
								<option value="[%$style[list].key%]">[%$style[list].name%]</option>
								[%/forlist%]
							</select>
							<span class="cautiontitle">[%$ST.callmain_add_style_mess%]</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="sugtitle">
				<span class="sugtitleicon"><span class="strong colorgorning2">[%$ST.callmain_add_baseinfo%]</span></span>
			</div>
			<div class="sugtitle-line"></div>
			<div class="formdiv">
				<table border="0" width="100%">
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">[%$ST.callmain_add_code%]</td>
						<td width="85%" class="trtitle02" id="codetext"><textarea name="code" id="code" style="width:98%;height:80px;" class="smallInput"></textarea></td>
					</tr>
				</table>
			</div>
		</div>
	</div>
	<div id="downbotton">
		<div id="subbotton">
			<table border="0" width="100%">
				<tr>
					<td id="right"><input type="submit" id="submitbotton" name="Submit" value="[%$ST.botton_add%]" class="buttonface" /></td>
					<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="[%$ST.botton_add_reset%]" class="buttonface" /></td>
				</tr>
			</table>
		</div>
	</div>
</form>
</body>

</html>